.\" -*- nroff -*-
.de IQ
.  br
.  ns
.  IP "\\$1"
..
.TH ovs\-testcontroller 8 "2.5.0" "Open vSwitch" "Open vSwitch Manual"
.ds PN ovs\-testcontroller
.
.SH NAME
ovs\-testcontroller \- simple OpenFlow controller for testing
.
.SH SYNOPSIS
.B ovs\-testcontroller
[\fIoptions\fR] \fImethod\fR \fB[\fImethod\fR]\&...
.
.SH DESCRIPTION
\fBovs\-testcontroller\fR is a simple OpenFlow controller that manages
any number of switches over the OpenFlow protocol, causing them to
function as L2 MAC-learning switches or hubs.  It is suitable for
initial testing of OpenFlow networks.  It is not a necessary or
desirable part of a production OpenFlow deployment.
.PP
\fBovs\-testcontroller\fR controls one or more OpenFlow switches, specified as
one or more of the following OpenFlow connection methods:
.
.RS
.IP "\fBpssl:\fR[\fIport\fR][\fB:\fIip\fR]"
.IQ "\fBptcp:\fR[\fIport\fR][\fB:\fIip\fR]"
Listens for OpenFlow connections on \fIport\fR.  The default
\fIport\fR is 6653.  By default, connections
are allowed from any IPv4 address.  Specify \fIip\fR as an IPv4
address or a bracketed IPv6 address (e.g. \fBptcp:6653:[::1]\fR).  DNS
names may not be used.  For \fBpssl\fR, the
\fB\-\-private\-key\fR,\fB\-\-certificate\fR, and \fB\-\-ca\-cert\fR
options are mandatory.
.IP
.
.IP "\fBpunix:\fIfile\fR"
Listens for OpenFlow connections on the Unix domain server socket
named \fIfile\fR.
.IP "\fBssl:\fIip\fR[\fB:\fIport\fR]"
.IQ "\fBtcp:\fIip\fR[\fB:\fIport\fR]"
The specified \fIport\fR on the host at the given \fIip\fR, which must
be expressed as an IP address (not a DNS name) in IPv4 or IPv6 address
format.  Wrap IPv6 addresses in square brackets,
e.g. \fBtcp:[::1]:6653\fR.  For \fBssl\fR, the \fB\-\-private\-key\fR,
\fB\-\-certificate\fR, and \fB\-\-ca\-cert\fR options are mandatory.
.IP
If \fIport\fR is not specified, it defaults to 6653.
.TP
\fBunix:\fIfile\fR
On POSIX, a Unix domain server socket named \fIfile\fR.
.IP
On Windows, a localhost TCP port written in \fIfile\fR.
.RE
.
.SH OPTIONS
.IP "\fB\-n\fR"
.IQ "\fB\-\-noflow\fR"
By default, \fBovs\-testcontroller\fR sets up a flow in each OpenFlow switch
whenever it receives a packet whose destination is known due through
MAC learning.  This option disables flow setup, so that every packet
in the network passes through the controller.
.IP
This option is most useful for debugging.  It reduces switching
performance, so it should not be used in production.
.
.TP
\fB\-\-max\-idle=\fIsecs\fR|\fBpermanent\fR
Sets \fIsecs\fR as the number of seconds that a flow set up by the
controller will remain in the switch's flow table without any matching
packets being seen.  If \fBpermanent\fR is specified, which is not
recommended, flows will never expire.  The default is 60 seconds.
.IP
This option has no effect when \fB\-n\fR (or \fB\-\-noflow\fR) is in use
(because the controller does not set up flows in that case).
.
.IP "\fB\-H\fR"
.IQ "\fB\-\-hub\fR"
By default, the controller acts as an L2 MAC-learning switch.  This
option changes its behavior to that of a hub that floods packets on
all but the incoming port.
.IP
If \fB\-H\fR (or \fB\-\-hub\fR) and \fB\-n\fR (or \fB\-\-noflow\fR) are used
together, then the cumulative effect is that every packet passes
through the controller and every packet is flooded.
.IP
This option is most useful for debugging.  It reduces switching
performance, so it should not be used in production.
.
.IP "\fB\-w\fR[\fIwildcard_mask\fR]"
.IQ "\fB\-\-wildcards\fR[\fB=\fIwildcard_mask\fR]\fR"
By default, \fBovs\-testcontroller\fR sets up exact-match flows.  This
option allows it to set up wildcarded flows, which may reduce
flow setup latency by causing less traffic to be sent up to the
controller.
.IP
The optional \fIwildcard_mask\fR is an OpenFlow wildcard bitmask in
hexadecimal that specifies the fields to wildcard.  If no
\fIwildcard_mask\fR is specified, the default value 0x2820F0 is used
which specifies L2-only switching and wildcards L3 and L4 fields.
Another interesting value is 0x2000EC, which specifies L3-only
switching and wildcards L2 and L4 fields.
.IP
This option has no effect when \fB\-n\fR (or \fB\-\-noflow\fR) is in use
(because the controller does not set up flows in that case).
.
.IP "\fB\-N\fR"
.IQ "\fB\-\-normal\fR"
By default, \fBovs\-testcontroller\fR directs packets to a particular port
or floods them.  This option causes it to direct non-flooded packets
to the OpenFlow \fBOFPP_NORMAL\fR port.  This allows the switch itself
to make decisions about packet destinations.  Support for
\fBOFPP_NORMAL\fR is optional in OpenFlow, so this option may not well
with some non-Open vSwitch switches.
.
.IP "\fB\-\-mute\fR"
Prevents ovs\-testcontroller from replying to any OpenFlow messages sent
to it by switches.
.IP
This option is only for debugging the Open vSwitch implementation of
``fail open'' mode.  It must not be used in production.
.
.IP "\fB\-q \fIid\fR"
.IQ "\fB\-\-queue=\fIid\fR"
By default, \fBovs\-testcontroller\fR uses the default OpenFlow queue for
sending packets and setting up flows.  Use one of these options,
supplying \fIid\fR as an OpenFlow queue ID as a decimal number, to
instead use that specific queue.
.IP
This option is incompatible with \fB\-N\fR or \fB\-\-normal\fR and
with \fB\-H\fR or \fB\-\-hub\fR.  If more than one is specified then
this option takes precedence.
.IP
This option may be useful for testing or debugging quality of service
setups.
.
.IP "\fB\-Q \fIport-name\fB:\fIqueue-id\fR"
.IP "\fB\-\-port\-queue \fIport-name\fB:\fIqueue-id\fR"
Configures packets received on the port named \fIport-name\fR
(e.g. \fBeth0\fR) to be output on OpenFlow queue ID \fIqueue-id\fR
(specified as a decimal number).  For the specified port, this option
overrides the default specified on \fB\-q\fR or \fB\-\-queue\fR.
.IP
This option may be specified any number of times with different
\fIport-name\fR arguments.
.IP
This option is incompatible with \fB\-N\fR or \fB\-\-normal\fR and
with \fB\-H\fR or \fB\-\-hub\fR.  If more than one is specified then
this option takes precedence.
.IP
This option may be useful for testing or debugging quality of service
setups.
.
.IP "\fB\-\-with\-flows \fIfile\fR"
When a switch connects, push the flow entries as described in
\fIfile\fR.  Each line in \fIfile\fR is a flow entry in the format
described for the \fBadd\-flows\fR command in the \fBFlow Syntax\fR
section of the \fBovs\-ofctl\fR(8) man page.
.IP
Use this option more than once to add flows from multiple files.
.
.SS "Public Key Infrastructure Options"
.de IQ
.  br
.  ns
.  IP "\\$1"
..
.IP "\fB\-p\fR \fIprivkey.pem\fR"
.IQ "\fB\-\-private\-key=\fIprivkey.pem\fR"
Specifies a PEM file containing the private key used as \fB\*(PN\fR's
identity for outgoing SSL connections.
.
.IP "\fB\-c\fR \fIcert.pem\fR"
.IQ "\fB\-\-certificate=\fIcert.pem\fR"
Specifies a PEM file containing a certificate that certifies the
private key specified on \fB\-p\fR or \fB\-\-private\-key\fR to be
trustworthy.  The certificate must be signed by the certificate
authority (CA) that the peer in SSL connections will use to verify it.
.
.IP "\fB\-C\fR \fIcacert.pem\fR"
.IQ "\fB\-\-ca\-cert=\fIcacert.pem\fR"
Specifies a PEM file containing the CA certificate that \fB\*(PN\fR
should use to verify certificates presented to it by SSL peers.  (This
may be the same certificate that SSL peers use to verify the
certificate specified on \fB\-c\fR or \fB\-\-certificate\fR, or it may
be a different one, depending on the PKI design in use.)
.
.IP "\fB\-C none\fR"
.IQ "\fB\-\-ca\-cert=none\fR"
Disables verification of certificates presented by SSL peers.  This
introduces a security risk, because it means that certificates cannot
be verified to be those of known trusted hosts.
.IP "\fB\-\-peer\-ca\-cert=\fIpeer-cacert.pem\fR"
Specifies a PEM file that contains one or more additional certificates
to send to SSL peers.  \fIpeer-cacert.pem\fR should be the CA
certificate used to sign \fB\*(PN\fR's own certificate, that is, the
certificate specified on \fB\-c\fR or \fB\-\-certificate\fR.  If
\fB\*(PN\fR's certificate is self-signed, then \fB\-\-certificate\fR
and \fB\-\-peer\-ca\-cert\fR should specify the same file.
.IP
This option is not useful in normal operation, because the SSL peer
must already have the CA certificate for the peer to have any
confidence in \fB\*(PN\fR's identity.  However, this offers a way for
a new installation to bootstrap the CA certificate on its first SSL
connection.
.ds DD
The following options are valid on POSIX based platforms.
.TP
\fB\-\-pidfile\fR[\fB=\fIpidfile\fR]
Causes a file (by default, \fB\*(PN.pid\fR) to be created indicating
the PID of the running process.  If the \fIpidfile\fR argument is not
specified, or
if it does not begin with \fB/\fR, then it is created in
\fB/usr/local/var/run/openvswitch\fR.
.IP
If \fB\-\-pidfile\fR is not specified, no pidfile is created.
.
.TP
\fB\-\-overwrite\-pidfile\fR
By default, when \fB\-\-pidfile\fR is specified and the specified pidfile 
already exists and is locked by a running process, \fB\*(PN\fR refuses 
to start.  Specify \fB\-\-overwrite\-pidfile\fR to cause it to instead 
overwrite the pidfile.
.IP
When \fB\-\-pidfile\fR is not specified, this option has no effect.
.
.IP \fB\-\-detach\fR
Runs \fB\*(PN\fR as a background process.  The process forks, and in
the child it starts a new session, closes the standard file
descriptors (which has the side effect of disabling logging to the
console), and changes its current directory to the root (unless
\fB\-\-no\-chdir\fR is specified).  After the child completes its
initialization, the parent exits.  \*(DD
.
.TP
\fB\-\-monitor\fR
Creates an additional process to monitor the \fB\*(PN\fR daemon.  If
the daemon dies due to a signal that indicates a programming error
(\fBSIGABRT\fR, \fBSIGALRM\fR, \fBSIGBUS\fR, \fBSIGFPE\fR,
\fBSIGILL\fR, \fBSIGPIPE\fR, \fBSIGSEGV\fR, \fBSIGXCPU\fR, or
\fBSIGXFSZ\fR) then the monitor process starts a new copy of it.  If
the daemon dies or exits for another reason, the monitor process exits.
.IP
This option is normally used with \fB\-\-detach\fR, but it also
functions without it.
.
.TP
\fB\-\-no\-chdir\fR
By default, when \fB\-\-detach\fR is specified, \fB\*(PN\fR 
changes its current working directory to the root directory after it 
detaches.  Otherwise, invoking \fB\*(PN\fR from a carelessly chosen 
directory would prevent the administrator from unmounting the file 
system that holds that directory.
.IP
Specifying \fB\-\-no\-chdir\fR suppresses this behavior, preventing
\fB\*(PN\fR from changing its current working directory.  This may be 
useful for collecting core files, since it is common behavior to write 
core dumps into the current working directory and the root directory 
is not a good directory to use.
.IP
This option has no effect when \fB\-\-detach\fR is not specified.
.
.TP
\fB\-\-user\fR
Causes \fB\*(PN\fR to run as a different user specified in "user:group", thus
dropping most of the root privileges. Short forms "user" and ":group" are also
allowed, with current user or group are assumed respectively. Only daemons
started by the root user accepts this argument.
.IP
On Linux, daemons will be granted CAP_IPC_LOCK and CAP_NET_BIND_SERVICES
before dropping root privileges. Daemons interact with datapath,
such as ovs-vswitchd, will be granted two additional capabilities, namely
CAP_NET_ADMIN and CAP_NET_RAW. The capability change will apply even if
new user is "root".
.IP
On Windows, this option is not currently supported. For security reasons,
specifying this option will cause the daemon process not to start.
.de IQ
.  br
.  ns
.  IP "\\$1"
..
.IP "\fB\-v\fR[\fIspec\fR]
.IQ "\fB\-\-verbose=\fR[\fIspec\fR]
.
Sets logging levels.  Without any \fIspec\fR, sets the log level for
every module and destination to \fBdbg\fR.  Otherwise, \fIspec\fR is a
list of words separated by spaces or commas or colons, up to one from
each category below:
.
.RS
.IP \(bu
A valid module name, as displayed by the \fBvlog/list\fR command on
\fBovs\-appctl\fR(8), limits the log level change to the specified
module.
.
.IP \(bu
\fBsyslog\fR, \fBconsole\fR, or \fBfile\fR, to limit the log level
change to only to the system log, to the console, or to a file,
respectively.  (If \fB\-\-detach\fR is specified, \fB\*(PN\fR closes
its standard file descriptors, so logging to the console will have no
effect.)
.IP
On Windows platform, \fBsyslog\fR is accepted as a word and is only
useful along with the \fB\-\-syslog\-target\fR option (the word has no
effect otherwise).
.
.IP \(bu
\fBoff\fR, \fBemer\fR, \fBerr\fR, \fBwarn\fR, \fBinfo\fR, or
\fBdbg\fR, to control the log level.  Messages of the given severity
or higher will be logged, and messages of lower severity will be
filtered out.  \fBoff\fR filters out all messages.  See
\fBovs\-appctl\fR(8) for a definition of each log level.
.RE
.
.IP
Case is not significant within \fIspec\fR.
.IP
Regardless of the log levels set for \fBfile\fR, logging to a file
will not take place unless \fB\-\-log\-file\fR is also specified (see
below).
.IP
For compatibility with older versions of OVS, \fBany\fR is accepted as
a word but has no effect.
.
.IP "\fB\-v\fR"
.IQ "\fB\-\-verbose\fR"
Sets the maximum logging verbosity level, equivalent to
\fB\-\-verbose=dbg\fR.
.
.IP "\fB\-vPATTERN:\fIdestination\fB:\fIpattern\fR"
.IQ "\fB\-\-verbose=PATTERN:\fIdestination\fB:\fIpattern\fR"
Sets the log pattern for \fIdestination\fR to \fIpattern\fR.  Refer to
\fBovs\-appctl\fR(8) for a description of the valid syntax for \fIpattern\fR.
.
.IP "\fB\-vFACILITY:\fIfacility\fR"
.IQ "\fB\-\-verbose=FACILITY:\fIfacility\fR"
Sets the RFC5424 facility of the log message. \fIfacility\fR can be one of
\fBkern\fR, \fBuser\fR, \fBmail\fR, \fBdaemon\fR, \fBauth\fR, \fBsyslog\fR,
\fBlpr\fR, \fBnews\fR, \fBuucp\fR, \fBclock\fR, \fBftp\fR, \fBntp\fR,
\fBaudit\fR, \fBalert\fR, \fBclock2\fR, \fBlocal0\fR, \fBlocal1\fR,
\fBlocal2\fR, \fBlocal3\fR, \fBlocal4\fR, \fBlocal5\fR, \fBlocal6\fR or
\fBlocal7\fR. If this option is not specified, \fBdaemon\fR is used as
the default for the local system syslog and \fBlocal0\fR is used while sending
a message to the target provided via the \fB\-\-syslog\-target\fR option.
.
.TP
\fB\-\-log\-file\fR[\fB=\fIfile\fR]
Enables logging to a file.  If \fIfile\fR is specified, then it is
used as the exact name for the log file.  The default log file name
used if \fIfile\fR is omitted is \fB/usr/local/var/log/openvswitch/\*(PN.log\fR.
.
.IP "\fB\-\-syslog\-target=\fIhost\fB:\fIport\fR"
Send syslog messages to UDP \fIport\fR on \fIhost\fR, in addition to
the system syslog.  The \fIhost\fR must be a numerical IP address, not
a hostname.
.
.IP "\fB\-\-syslog\-method=\fImethod\fR"
Specify \fImethod\fR how syslog messages should be sent to syslog daemon.
Following forms are supported:
.RS
.IP \(bu
\fBlibc\fR, use libc \fBsyslog()\fR function.  This is the default behavior.
Downside of using this options is that libc adds fixed prefix to every
message before it is actually sent to the syslog daemon over \fB/dev/log\fR
UNIX domain socket.
.IP \(bu
\fBunix:\fIfile\fR\fR, use UNIX domain socket directly.  It is possible to
specify arbitrary message format with this option.  However,
\fBrsyslogd 8.9\fR and older versions use hard coded parser function anyway
that limits UNIX domain socket use.  If you want to use arbitrary message
format with older \fBrsyslogd\fR versions, then use UDP socket to localhost
IP address instead.
.IP \(bu
\fBudp:\fIip\fR:\fIport\fR\fR, use UDP socket.  With this method it is
possible to use arbitrary message format also with older \fBrsyslogd\fR.
When sending syslog messages over UDP socket extra precaution needs to
be taken into account, for example, syslog daemon needs to be configured
to listen on the specified UDP port, accidental iptables rules could be
interfering with local syslog traffic and there are some security
considerations that apply to UDP sockets, but do not apply to UNIX domain
sockets.
.RE
.IP "\fB\-\-unixctl=\fIsocket\fR"
Sets the name of the control socket on which \fB\*(PN\fR listens for
runtime management commands (see \fBRUNTIME MANAGEMENT COMMANDS\fR,
below).  If \fIsocket\fR does not begin with \fB/\fR, it is
interpreted as relative to \fB/usr/local/var/run/openvswitch\fR.  If \fB\-\-unixctl\fR is
not used at all, the default socket is
\fB/usr/local/var/run/openvswitch/\*(PN.\fIpid\fB.ctl\fR, where \fIpid\fR is \fB\*(PN\fR's
process ID.
.IP
On Windows, uses a kernel chosen TCP port on the localhost to listen
for runtime management commands.  The kernel chosen TCP port value is written
in a file whose absolute path is pointed by \fIsocket\fR. If \fB\-\-unixctl\fR
is not used at all, the file is created as \fB\*(PN.ctl\fR in the configured
\fIOVS_RUNDIR\fR directory.
.IP
Specifying \fBnone\fR for \fIsocket\fR disables the control socket
feature.
.de IQ
.  br
.  ns
.  IP "\\$1"
..
.IP "\fB\-h\fR"
.IQ "\fB\-\-help\fR"
Prints a brief help message to the console.
.
.IP "\fB\-V\fR"
.IQ "\fB\-\-version\fR"
Prints version information to the console.
.de IQ
.  br
.  ns
.  IP "\\$1"
..
.IP "\fB\-O \fR[\fIversion\fR[\fB,\fIversion\fR]...]\fR"
.IQ "\fB\-\-protocols=\fR[\fIversion\fR[\fB,\fIversion\fR]...]\fR"
Sets the OpenFlow protocol versions that are allowed when establishing
an OpenFlow session.
.
.IP
The following versions are considered to be ready for general use.
These protocol versions are enabled by default:
.
.RS
.IP \(bu
\fBOpenFlow10\fR, for OpenFlow 1.0.
.RE
.
.IP
Support for the following protocol versions is provided for testing
and development purposes.  They are not enabled by default:
.
.RS
.IP \(bu
\fBOpenFlow11\fR, for OpenFlow 1.1.
.
.IP \(bu
\fBOpenFlow12\fR, for OpenFlow 1.2.
.
.IP \(bu
\fBOpenFlow13\fR, for OpenFlow 1.3.
.RE
.
.SH EXAMPLES
.PP
To bind locally to port 6653 (the default) and wait for incoming
connections from OpenFlow switches:
.IP
\fB% ovs\-testcontroller ptcp:\fR
.SH "BUGS"
.PP
Configuring a Citrix XenServer to connect to a particular controller
only points the remote OVSDB management connection to that controller.
It does not also configure OpenFlow connections, because the manager
is expected to do that over the management protocol.
\fBovs\-testcontroller\fR is not an Open vSwitch manager and does not know
how to do that.
.PP
As a stopgap workaround, \fBovs\-vsctl\fR can wait for an OVSDB
connection and set the controller, e.g.:
.IP
\fB% ovs\-vsctl \-t0 \-\-db=pssl: \-\-certificate=cert.pem
\-\-ca\-cert=none \-\-private\-key=privkey.pem
\-\-peer\-ca\-cert=cacert.pem set\-controller ssl:\fIip\fR
.SH "SEE ALSO"
.
.BR ovs\-appctl (8),
.BR ovs\-ofctl (8),
.BR ovs\-dpctl (8)
